package weixinkeji.dev.dc.base.user.h;

import weixinkeji.dev.dc.base.user.bean.FWY;
import weixinkeji.dev.dc.base.user.check.FWYCheck;
import sys.wx.ann.hm.H;
import sys.wx.ann.hm.M;
import sys.wx.c.ATR;
import sys.wx.c.components.cv.CV;
import sys.wx.m.db.SQL.mysql.common.where.Where;
import sys.wx.m.db.dao.mysql.Dao;

@H("weixinkeji/dev/dc/base/user/a")
public class FWYHA {

    ATR a;

    public FWYHA(ATR a) {
        this.a = a;
    }

    @M("/add")//通过 weixinkeji/dev/dc/base/user/a/add.imy 访问
    public String add() {
        FWY u = CV.getObject_Add(FWY.class, a.request, new FWYCheck().doFWY(false));
        if (null == u) {
            a.out_OK_NO(false, "检验不通过！添加失败。");
            return null;
        } else if (Dao.selectCount(FWY.class, Where.putThenGet(Where.TJ_IGNORE_NOTHING, null, "", "fwy_account", "=", u.getFwy_account())) > 0) {
            a.out_OK_NO(false, "检验不通过！账号已经被使用");
            return null;
        }
        a.out_OK_NO(Dao.add(u));
        return null;
    }

}
